<template>
    <div>
      <AplidForm
        ref="formRef"
        v-bind="BaseFormConfig"
        v-model="formModel"
        @submit="onSubmit">
      </AplidForm>
    </div>
  </template>
  
  <script setup lang="ts">
  import apiMod from '@/apiMod/index'
  import { useRoute } from 'vue-router';
  import {getStore} from '@/utils/store'
  import { dayjs } from 'element-plus'


  let emit = defineEmits(['refresh'])
  const route = useRoute()

    let creditCode = getStore('userInfo').organizationId || ''
    creditCode = creditCode==1?undefined:creditCode

  type Props = {
    nowRowData?:any
  }
  let props = withDefaults(defineProps<Props>(),{
    nowRowData:{}
  })
  let formModel = ref({})
  formModel.value = props.nowRowData
  const BaseFormConfig = {
    inline: false,
	showBtn: true,
	labelPosition: 'top',
	labelWidth: '120px',
	column: [
		{
			label: '备注',
			prop: 'solveRemark',
			type: 'input',
			span: 24,
		},
    ]
  }
  let formRef = ref()

  const onSubmit = (form, done) => {
    let params:any = formModel.value
    params.maintainState = 2
    params.solveStatus = 0
    params.solveTime = dayjs().format("YYYY-MM-DD hh:mm:ss")
    apiMod.view_dotEquipmentMaintainRecord_edit(params).then(res=>{
      done()
      emit('refresh')
    })
  }
  const onSave = () => {
    formRef.value!.onSubmit()
  }
  defineExpose({
    onSave
  })
  </script>
  
  <style scoped></style>
  